#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Author:liang futing
#@Time :2019/4/17 11:37
import json
from django.views.generic import CreateView
from django.shortcuts import HttpResponse
from .mixin import LoginRequiredMixin
from .models import Menu

class MenuCreateView(LoginRequiredMixin,CreateView):
    model = Menu
    fields = '__all__'
    success_url = '/system/rbac/menu/create/'

    def post(self,request,*args,**kwargs):
        res=dict(result=False)
        form=self.get_form()
        if form.is_valid():
            res['result']=True
        return HttpResponse(json.dumps(res),content_type='application/json')
